package com.hifar.test.api.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 接收端配置类
 * 用于配置数据资产管理平台接收端相关参数
 */
@Configuration
@ConfigurationProperties(prefix = "api.data-receiver")
public class ReceiverConfig {
    
    /**
     * 是否启用数据验证
     */
    private Boolean enableValidation = true;
    
    /**
     * 是否启用数据保存
     */
    private Boolean enableDataSave = true;
    
    /**
     * 最大接收数据量
     */
    private Integer maxDataSize = 1000;
    
    /**
     * 数据保存路径
     */
    private String dataSavePath = "./data";
    
    /**
     * 是否启用统计功能
     */
    private Boolean enableStatistics = true;
    
    /**
     * 统计报告间隔（分钟）
     */
    private Integer statisticsInterval = 60;
    
    /**
     * 是否启用IP白名单
     */
    private Boolean enableIpWhitelist = false;
    
    /**
     * IP白名单
     */
    private String ipWhitelist = "127.0.0.1,localhost";
    
    /**
     * 是否启用请求频率限制
     */
    private Boolean enableRateLimit = true;
    
    /**
     * 请求频率限制（每分钟请求数）
     */
    private Integer rateLimitPerMinute = 100;
    
    // Getters and Setters
    public Boolean getEnableValidation() {
        return enableValidation;
    }
    
    public void setEnableValidation(Boolean enableValidation) {
        this.enableValidation = enableValidation;
    }
    
    public Boolean getEnableDataSave() {
        return enableDataSave;
    }
    
    public void setEnableDataSave(Boolean enableDataSave) {
        this.enableDataSave = enableDataSave;
    }
    
    public Integer getMaxDataSize() {
        return maxDataSize;
    }
    
    public void setMaxDataSize(Integer maxDataSize) {
        this.maxDataSize = maxDataSize;
    }
    
    public String getDataSavePath() {
        return dataSavePath;
    }
    
    public void setDataSavePath(String dataSavePath) {
        this.dataSavePath = dataSavePath;
    }
    
    public Boolean getEnableStatistics() {
        return enableStatistics;
    }
    
    public void setEnableStatistics(Boolean enableStatistics) {
        this.enableStatistics = enableStatistics;
    }
    
    public Integer getStatisticsInterval() {
        return statisticsInterval;
    }
    
    public void setStatisticsInterval(Integer statisticsInterval) {
        this.statisticsInterval = statisticsInterval;
    }
    
    public Boolean getEnableIpWhitelist() {
        return enableIpWhitelist;
    }
    
    public void setEnableIpWhitelist(Boolean enableIpWhitelist) {
        this.enableIpWhitelist = enableIpWhitelist;
    }
    
    public String getIpWhitelist() {
        return ipWhitelist;
    }
    
    public void setIpWhitelist(String ipWhitelist) {
        this.ipWhitelist = ipWhitelist;
    }
    
    public Boolean getEnableRateLimit() {
        return enableRateLimit;
    }
    
    public void setEnableRateLimit(Boolean enableRateLimit) {
        this.enableRateLimit = enableRateLimit;
    }
    
    public Integer getRateLimitPerMinute() {
        return rateLimitPerMinute;
    }
    
    public void setRateLimitPerMinute(Integer rateLimitPerMinute) {
        this.rateLimitPerMinute = rateLimitPerMinute;
    }
    
    @Override
    public String toString() {
        return "ReceiverConfig{" +
                "enableValidation=" + enableValidation +
                ", enableDataSave=" + enableDataSave +
                ", maxDataSize=" + maxDataSize +
                ", dataSavePath='" + dataSavePath + '\'' +
                ", enableStatistics=" + enableStatistics +
                ", statisticsInterval=" + statisticsInterval +
                ", enableIpWhitelist=" + enableIpWhitelist +
                ", ipWhitelist='" + ipWhitelist + '\'' +
                ", enableRateLimit=" + enableRateLimit +
                ", rateLimitPerMinute=" + rateLimitPerMinute +
                '}';
    }
}
